let {pool} = require('./pool')
let findComment = (handle)=>{
    pool.getConnection((err,connection)=>{
        if (err) throw err;
        let sql = "select * from base_user"
        connection.query(sql,[],(err,result)=>{
          handle(result)
          connection.release() 
        });
      })
}
let deleteComment=(handle)=>{
  pool.getConnection((err,connection)=>{
    if (err) throw err;
    let sql = "delete from ej_comment where id=?"
    connection.query(sql,(err,result)=>{
        
      handle(result)
      connection.release() 
    });
  })
}
let saveOrUpdate = (handle,obj)=>{
  pool.getConnection((err,connection)=>{
    if (err) throw err;
    
      //新增
    var sql = "insert into base_user(id,user_name,user_password) values(?,?,?)"
    connection.query(sql,[obj.status,obj.content,obj.id],(err,result)=>{
      if(err){
        throw err;
      }

      handle(result)
      connection.release() 
    });
  })
}
module.exports={
    findComment,
    deleteComment,
    saveOrUpdate
}